from .client import CommonClient
from .client import ApiClient
from ..utils.url_params import OpenApiUrlParams

"""
SignTaskClient
签署任务管理
"""


class SignTaskClient(ApiClient):
    # 创建签署任务
    def create(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_CREATE, data)

    # 创建签署任务 (基于签署模板)
    def create_with_template(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_CREATE_WITH_TEMPLATE, data)

    # 添加签署任务文档
    def add_docs(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_ADD_DOCS, data)

    # 移除签署任务文档
    def delete_docs(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_DELETE_DOCS, data)

    # 添加签署任务控件
    def add_fields(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_ADD_FIELD, data)

    # 移除签署任务控件
    def delete_fields(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_DELETE_FIELD, data)

    # 获取签署任务控件设置链接
    def get_fields_edit_url(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_GET_FIELDS_EDIT_URL, data)

    # 填写签署任务控件内容
    def fill_fields_value(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_FILL_FIELDS_VALUE, data)

    # 添加签署任务附件
    def add_attachs(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_ADD_ATTACHS, data)

    # 移除签署任务附件
    def delete_attachs(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_DELETE_ATTACHS, data)

    # 添加签署任务参与方
    def add_actors(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_ADD_ACTORS, data)

    # 移除签署任务参与方
    def delete_actor(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_DELETE_ACTOR, data)

    # 发起签署任务
    def initiate(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_INITIATE, data)

    # 撤销签署任务
    def cancel(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_CANCEL, data)

    # 定稿签署任务文档
    def finalize_docs(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_DOC_FINALIZE, data)

    # 阻塞签署任务
    def block(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_BLOCK, data)

    # 解阻签署任务
    def unblock(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_UNBLOCK, data)

    # 催办签署任务
    def urge(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_URGE, data)

    # 结束签署任务
    def finish(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_FINISH, data)

    # 获取签署任务详情
    def get_detail(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_GET_DETAIL, data)

    # 下载签署任务文档
    def download_docs(self, data):
        return CommonClient.post_stream(self, OpenApiUrlParams.SIGN_TASK_DOWNLOAD_DOCS, data)

    # 获取签署任务链接
    def get_url(self, data):
        return CommonClient.post_json(self, OpenApiUrlParams.SIGN_TASK_GET_URL, data)
